﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Yunzuan.Foundation.Web.MVC
{
    public class LoginValidateFilterAttribute : ActionFilterAttribute
    {
        public bool IsSkip { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!this.IsSkip)
            {
                if (SessionManager.GetSession<int>("UserID") <= 0)
                {
                    filterContext.HttpContext.Response.Redirect("/login");
                }
            }
            base.OnActionExecuting(filterContext);
        }
    }
}
